
import { INCREMENT , DECREMENT } from "../constant/countAlias"
const init = {
    count : 0
}

export default function  countReducer(preState = init, action ) {
    const {type,data} = action
    switch(type){
        case INCREMENT :
            return {
                ...init, count :  preState.count + data
            }
        case DECREMENT :
            return {
                ...init, count :  preState.count - data
            }   
            default: return preState
    }
    
}